﻿using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.ComponentModel.Composition;
using Infrastructure.Behaviour;
using Microsoft.Practices.Prism.Regions;

namespace LoginModule.View
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    [ViewExport( RegionName = "MainRegion" )]
    [PartCreationPolicy( CreationPolicy.Shared )]
    //[ViewSortHint( "1" )]
    public partial class LoginView : UserControl
    {
        BalanceAcc windowBalanceAcc = null;

        #region Constructor

        public LoginView()
        {
            InitializeComponent();
        }
        #endregion Constructor

        #region Member 

        #endregion Member

        #region Method

        private void Button_KeyUp( object sender, KeyEventArgs e )
        {
            if ( Key.Enter == e.Key )
            {
                Button_Click( sender, e );
            }
        }

        private void Button_Click( object sender, RoutedEventArgs e )
        {
            string strUserName = txtUserName.Text;
            string strPassword = pwPassword.Password;

            if ( !string.IsNullOrWhiteSpace( strUserName ) && !string.IsNullOrWhiteSpace( strPassword )
                && strUserName == "abc" && strPassword == "123" )
            {
                this.Content = null;
                windowBalanceAcc = new View.BalanceAcc();
                //windowBalanceAcc.Show();
                //this.Close();

                
            }
        }

        #endregion Method
    }
}
